package com.cssy.yd.logic.dao.impl;

import com.cssy.yd.logic.dao.LogicPoDAO;
import com.cssy.yd.logic.entity.LogicPoDO;
import com.cssy.yd.logic.entity.PoGatherExecuteReportFormsDO;
import com.cssy.yd.logic.entity.PoGatherReportFormsDO;
import com.cssy.yd.logic.entity.PoItemExecuteReportFormsDO;
import com.cssy.yd.logic.entity.PoItemReportFormsDO;
import com.plat.helper.SearchConditions;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * ��ݷ��ʶ���ʵ����
 * @since 2013-07-18
 */
public class LogicPoDAOImpl extends SqlMapClientDaoSupport implements LogicPoDAO {

    /**
     * �������
     * @param logicPoDO
     * @return ������ݵ�����
     */
    public String insertLogicPoDO(LogicPoDO logicPoDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicPo.insert", logicPoDO);
        return (String) id;
    }

    /**
     * ͳ�Ƽ�¼��
     * @param logicPoDO
     * @return ����ļ�¼��
     */
    public Integer countLogicPoDOByExample(LogicPoDO logicPoDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo.countByDOExample", logicPoDO);
        return count;
    }

    /**
     * ���¼�¼
     * @param logicPoDO
     * @return ��Ӱ�������
     */
    public Integer updateLogicPoDO(LogicPoDO logicPoDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicPo.update", logicPoDO);
        return result;
    }

    /**
     * ��ȡ�����б�
     * @param logicPoDO
     * @return �����б�
     */
    @SuppressWarnings("unchecked")
    public List<LogicPoDO> findListByExample(LogicPoDO logicPoDO) throws DataAccessException {
        List<LogicPoDO> list = getSqlMapClientTemplate().queryForList("LogicPo.findListByDO", logicPoDO);
        return list;
    }

    /**
     * ��������ȡlogicPoDO
     * @param id
     * @return logicPoDO
     */
    public LogicPoDO findLogicPoDOByPrimaryKey(String id) throws DataAccessException {
        LogicPoDO logicPoDO = (LogicPoDO) getSqlMapClientTemplate().queryForObject("LogicPo.findByPrimaryKey", id);
        return logicPoDO;
    }

    /**
     * ɾ���¼
     * @param id
     * @return ��Ӱ�������
     */
    public Integer deleteLogicPoDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPo.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicPoDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicPoDO> list = getSqlMapClientTemplate().queryForList("LogicPo_ex.find", scs);
		   return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo_ex.count", scs);
	      return count;
	}

	@Override
	public LogicPoDO findcode(String code) throws DataAccessException {
		LogicPoDO logicPoDO = (LogicPoDO) getSqlMapClientTemplate().queryForObject("LogicPo_ex.findcode", code);
		return logicPoDO;
	}

	@Override
	public List<PoGatherReportFormsDO> findPoGather(Map<String, Object> map)
			throws DataAccessException {
		List<PoGatherReportFormsDO> lFormsDOs = getSqlMapClientTemplate().queryForList("LogicPo_ex.findPoCather", map);
		return lFormsDOs;
	}
	@Override
	public Integer findPoGatherCount(Map<String, Object> map) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo_ex.findPoCatherCount", map);
	      return count;
	}
	

	@Override
	public List<PoItemReportFormsDO> findPoItem(Map<String, Object> map)
			throws DataAccessException {
		List<PoItemReportFormsDO> lFormsDOs = getSqlMapClientTemplate().queryForList("LogicPo_ex.findPoItem", map);
		return lFormsDOs;
	}
	@Override
	public Integer findPoItemCount(Map<String, Object> map) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo_ex.findPoItemCount", map);
	      return count;
	}
	

	@Override
	public List<PoGatherExecuteReportFormsDO> findPoGatherExecute(
			Map<String, Object> map) throws DataAccessException {
		List<PoGatherExecuteReportFormsDO> list =  getSqlMapClientTemplate().queryForList("LogicPo_ex.findPoCatherExecute", map);
		return list;
	}
	@Override
	public Integer findPoGatherExecuteCount(Map<String, Object> map) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo_ex.findPoCatherExecuteCount", map);
	      return count;
	}
	
	

	@Override
	public List<PoItemExecuteReportFormsDO> findPoItemExecute(
			Map<String, Object> map) throws DataAccessException {
		List<PoItemExecuteReportFormsDO> list =  getSqlMapClientTemplate().queryForList("LogicPo_ex.findItemExecute", map);
		return list;
	}
	@Override
	public Integer findPoItemExecuteCount(Map<String, Object> map) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPo_ex.findItemExecuteCount", map);
	      return count;
	}
}